﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace MyTest
{
    public partial class Form1 : Form
    {
        FormChild1 formChild1 = new FormChild1();
        FormChild2 formChild2 = new FormChild2();




        public Form1()
        {
            InitializeComponent();
        }

        private void c1Button1_Click(object sender, EventArgs e)
        {
            formChild1.Show();
            formChild2.Hide();
        }

        private void c1Button2_Click(object sender, EventArgs e)
        {
            formChild1.Hide();
            formChild2.Show();
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            formChild1.TopLevel = false;
            formChild2.TopLevel = false;

            this.Controls.Add(formChild1);
            this.Controls.Add(formChild2);

            formChild1.Parent = panel1;
            formChild2.Parent = panel1;


            formChild1.Show();
            formChild2.Hide();

        }

        private void Form1_KeyDown(object sender, KeyEventArgs e)
        {

        }

        private void Form1_KeyPress(object sender, KeyPressEventArgs e)
        {


        }

        private void ApplicationExit()
        {
            DialogResult ret = 0;
            ret = MessageBox.Show("종료하시겠습니까?", "종료", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
            if (ret == DialogResult.Yes)
                Application.Exit();
        }

        private void c1Button3_Click(object sender, EventArgs e)
        {
            ApplicationExit();
        }

        private void Form1_PreviewKeyDown(object sender, PreviewKeyDownEventArgs e)
        {

        }
    }
}
